package org.example.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@Document(indexName = "discussion",createIndex = true)
public class EsDiscussion {
    @Id
    @Field(type = FieldType.Text)
    private String id;      //_id

    @Field(type = FieldType.Text,analyzer="icu_analyzer")
    private String title;
    @Field(type = FieldType.Text,analyzer="icu_analyzer")
    private String type;
    @Field(type = FieldType.Text,analyzer="icu_analyzer")
    private String content;
    @Field(type = FieldType.Date,format = DateFormat.basic_date_time)
    private Date createTime;
    @Field(type = FieldType.Date,format = DateFormat.basic_date_time)
    private Date updateTime;
    @Field(type = FieldType.Integer)
    private int click;
    @Field(type = FieldType.Integer)
    private int likes;
    @Field(type = FieldType.Integer)
    private int userId;
    @Field(type = FieldType.Text)
    private String userIcon;
    @Field(type = FieldType.Integer)
    private int commentNumber;
}